﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using XZen.Blogger;
using System.Diagnostics;
using System.Drawing;
using System.ComponentModel;
using Newtonsoft.Json;

namespace BlobTest
{

    [TestClass]
    public class ImageTest
    {
        string userName = "rijusmit";
        string password = "$Rijusmit2014";
        string subscription = "blogger";
        string contentUri = "http://localhost";
        MagazineService service;
        [TestMethod]
        public void CreateBlog()
        {
            service = MagazineService.Create(userName, password, contentUri, subscription);
            string srcFile = @"C:\Work\POC\xzen\Solutions\xzen.client4.0\Blogger\Images\IMG_2821.JPG";
            string destFile = @"c:\temp\gol.jpg";
            Image data = service.ResizeImage(600, 800, System.IO.File.ReadAllBytes(srcFile));
            data.Save(destFile);
        }
        [TestMethod]
        public void TestClass()
        {
            Magazine mag = new Magazine();
            foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(mag))
            {
                
                string name = descriptor.Name;
                object value = descriptor.GetValue(mag);
                Console.WriteLine("{0}={1}", name, value);
                Debug.WriteLine("{0}={1}", name, value);
            }
        }
        [TestMethod]
        public void TestClassJSON()
        {
            Magazine mag = new Magazine();

           string data = System.Web.Helpers.Json.Encode(mag);
           Debug.WriteLine(data);
        }
    }
}
